<template>
  <div>
    <div v-for="(component, index) in configData" :key="index">
      <component :is="component.name + 'Config'" v-model="component.content" :title="component.title" />
    </div>
    <AddComponentPanel :page-key="'home'" @add="addComponent" />
  </div>
</template>
<script>
// 首页只使用 Search 和 Banner 配置
import SearchConfig from './SearchConfig.vue';
import BannerConfig from './BannerConfig.vue';
import AddComponentPanel from '../AddComponentPanel.vue';

export default {
  name: "HomeConfig",
  components: { SearchConfig, BannerConfig, AddComponentPanel },
  props: ['value'],
  computed: {
    configData: {
      get() { return this.value },
      set(newValue) { this.$emit('input', newValue) }
    }
  },
  methods: {
    addComponent(component) {
      this.configData.push(component);
    }
  }
}
</script>
